<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'frontend.main.class.php');
$feObj = new FrontendMainBase();

//
$feObj->tpl->setCaching(true);
$feObj->tpl->setTplFile('pagelayout/pagelayout_main_home.tpl');
$feObj->tpl->setCacheID('home');
if( $feObj->tpl->isCached() == false ) {
//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/page/page.class.php');
$mObj = new PageBase();
$mObj->format = true;

//welcome
$page_welcome = $mObj->getItem('welcome', 'link');
$feObj->addInject('page_welcome', $page_welcome);

//about
$page_about = $mObj->getItem('about', 'link');
$feObj->addInject('page_about', $page_about);

$items = $mObj->getItems(array('cid:=' => '1'), 0);
$feObj->addInject('about_items', $items);

//support
$page_support = $mObj->getItem('support', 'link');
$feObj->addInject('page_support', $page_support);

//audition
$page_audition = $mObj->getItem('audition', 'link');
$feObj->addInject('page_audition', $page_audition);

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/news/news.class.php');
$mObj = new NewsBase();
$mObj->format = true;
$mObj->setQueryLimitLength(20);
$items = $mObj->getItems('', 0);
$feObj->addInject('news_items', $items);

//staff
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/staff/staff.class.php');
$mObj = new StaffBase();
$mObj->format = true;
$mObj->setQueryLimitLength(20);
$items = $mObj->getItems('', 0);
$feObj->addInject('staff_items', $items);

//gallery
//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/gallery/gallery.category.class.php');
$mcObj = new GalleryCategoryBase();
$mcObj->format = true;
//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/gallery/gallery.album.class.php');
$maObj = new GalleryAlbumBase();
$maObj->format = true;
//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/gallery/gallery.image.class.php');
$mObj = new GalleryImageBase();
$mObj->format = true;

//album
$albums = $maObj->getItems('', 0, false);
$feObj->content_wrap['photo_albums'] = $albums;

//image
$items = $mObj->getItems('', 0, false);
$feObj->content_wrap['photo_items'] = $items;
$feObj->content_wrap['photo_item'] = $items['0'];

//
}//end cache

//
echo $feObj->display('pagelayout/pagelayout_main_home.tpl');
//
?>